package com.example.controller;

import com.example.common.Result;
import com.example.entity.PetActionLog;
import com.example.service.PetActionLogService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author HY
 * @date 2025/2/16
 */
@RestController
@RequestMapping("/petActionLog")
public class PetActionLogController {
    @Autowired
    private PetActionLogService petActionLogService;

    @PostMapping("/add")
    public Result add(@RequestBody PetActionLog petActionLog) {
        petActionLogService.add(petActionLog);
        return Result.success();
    }

    @GetMapping("/list")
    public Result list(PetActionLog petActionLog,
                                 @RequestParam Integer pageNum,
                                 @RequestParam Integer pageSize) {
        PageInfo<PetActionLog> pageInfo = petActionLogService.selectPage(petActionLog, pageNum, pageSize);
        return Result.success(pageInfo);
    }
}
